package com.ruoyi.framework.config;

import com.baidu.aip.ocr.AipOcr;
import lombok.Setter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ab785
 * createTime: 2021-11-29.
 * description: 百度识别配置
 */
@Setter
@Configuration
@ConfigurationProperties(prefix = "baidu.aip")
@ConditionalOnProperty(prefix = "baidu.aip",name = "enable",havingValue = "true")
public class BaiduAipConfig {

    private String appId;

    private String apiKey;

    private String secretKey;

    @Bean
    public AipOcr aipOcr() {
        return new AipOcr(appId, apiKey, secretKey);
    }

}
